import http,re,pdb
from .. import config

def filesystem(handler):
    #handler.send_response(http.HTTPStatus.NOT_FOUND)
    permitted_rules=[
            re.compile('./images/.*'),
            ]
    for rule in permitted_rules:
        matched=rule.match(handler.url)
        if matched and matched.start()==0 and matched.end()==len(handler.url):
            handler.send_response(http.HTTPStatus.OK)
            handler.end_headers()
            with open(handler.url,'rb') as fsfile:
                handler.wfile.write(fsfile.read())
            return
    handler.send_response(http.HTTPStatus.NOT_FOUND)


